#include <vector>

#include "xpath_static.h"
#include "tinyxml.h"
#include "student.h"
#include "lib.h"


using namespace utils;

Student::Student( const TiXmlElement* pStudentElement ) throw( Exception )
{
	const char* czAttVal = NULL;

	czAttVal = pStudentElement->Attribute( "name" );
	m_sName = czAttVal ? czAttVal : "";

	czAttVal = pStudentElement->Attribute( "surname" );
	m_sSurname = czAttVal ? czAttVal : "";

	czAttVal = pStudentElement->Attribute( "familyname" );
	m_sFamilyName = czAttVal ? czAttVal : "";

	czAttVal = pStudentElement->Attribute( "egn" );
	m_sEGN = czAttVal ? czAttVal : "";

	czAttVal = pStudentElement->Attribute( "fn" );
	m_nFN = czAttVal ? utils::StringToNum( czAttVal ) : utils::StringToNum( "-1" );

	czAttVal = pStudentElement->Attribute( "year" );
	m_nYear = czAttVal ? utils::StringToNum( czAttVal ) : utils::StringToNum( "" );

	czAttVal = pStudentElement->Attribute( "averagemark" );
	m_dAverageMark = czAttVal ? utils::StringToDouble( czAttVal ) : utils::StringToDouble( "" );

	czAttVal = pStudentElement->Attribute( "disciplines" );
	m_sDisciplines = czAttVal ? czAttVal : "";

}

std::string Student::GetName() const throw()
{
	return m_sName;
}

std::string Student::GetSurname() const throw()
{
	return m_sSurname;
}

std::string Student::GetFamilyName() const throw()
{
	return m_sFamilyName;
}

std::string Student::GetEGN() const throw()
{
	return m_sEGN;
}

std::string Student::GetDiscipline() const throw()
{
	return m_sDisciplines;
}


unsigned int Student::GetFN() const throw()
{
	return m_nFN;
}

unsigned int Student::GetYear() const throw()
{
	return m_nYear;
}

double Student::GetAverageMark() const throw()
{
	return m_dAverageMark;
}
